This is for developers that are building applications and want to leverage Indeed OAuth in their process.
The code are based on the Indeed authorization documentations (linked below):
https://developer.indeed.com/docs/authorization/3-legged-oauth
https://developer.indeed.com/docs/authorization/2-legged-oauth
normal users: implementation 'com.indeed:oauth-client'
NOTE 1: Make sure you followed the Indeed Authorization documentation to get your application client id
@Configuration
public class ApplicationConfig {
public static final String INDEED_SECURE_HOST_NAME = "https://secure.indeed.com";
@Bean
TwoLeggedOAuthClient twoLeggedOAuthClient() throws IOException, GeneralException {
return create2LeggedOAuth2Client(
clientId,
clientSecret,
INDEED_SECURE_HOST_NAME);
}
@Bean
ThreeLeggedOAuthClient threeLeggedOAuthClient() throws IOException, GeneralException {
return create3LeggedOAuth2Client(
clientId,
clientSecret,
INDEED_SECURE_HOST_NAME);
}
}
public class Example {
@Autowired
ThreeLeggedOAuthClient threeLeggedOAuthClient;
URI get3LeggedOAuthCodeUrl(final String state) throws URISyntaxException {
return new ResponseEntity<>(
threeLeggedOAuthClient.getAuthorizeUrl(
state,
new String[]{EMAIL, OFFLINE_ACCESS, EMPLOYER_ACCESS},
null,
clientRedirectUrl),
HttpStatus.OK);
}
}
public class Example {
@Autowired
ThreeLeggedOAuthClient threeLeggedOAuthClient;
@Autowired
TwoLeggedOAuthClient twoLeggedOAuthClient;
OIDCTokens get3LeggedAccessToken(final String code) throws IOException, URISyntaxException, ParseException {
return threeLeggedOAuthClient.getUserOAuthCredentials(code, clientRedirectUrl);
}
OIDCTokens get2LeggedAccessToken() throws IOException, ParseException {
return twoLeggedOAuthClient.getAppOAuthCredentials(new String[] {EMPLOYER_ACCESS});
}
}
public class Example {
@Autowired
ThreeLeggedOAuthClient threeLeggedOAuthClient;
@Autowired
TwoLeggedOAuthClient twoLeggedOAuthClient;
OIDCTokens get3LeggedEmployerToken(final String code, final String employerId) throws URISyntaxException, IOException, ParseException {
return threeLeggedOAuthClient.getEmployerOAuthCredentials(code, clientRedirectUrl, employerId);
}
OIDCTokens get2LeggedEmployerToken(final String employerId) throws IOException, ParseException {
return twoLeggedOAuthClient.getEmployerOAuthCredentials(employerId, new String[] {EMPLOYER_ACCESS});
}
}
public class Example {
@Autowired
ThreeLeggedOAuthClient threeLeggedOAuthClient;
OIDCTokens refresh3LAccessToken(final String refreshToken) throws IOException, ParseException {
return threeLeggedOAuthClient.refreshOAuthCredentials(refreshToken);
}
}
Use this OAuth flow in applications that act on behalf of another user. Indeed displays an OAuth consent screen for users to login and give applications specific permissions.
Use this OAuth flow in applications that act on behalf of the Indeed user that registered the app and the employer accounts associated with that Indeed user.
If an issue doesn’t already exist that describes the change you want to make, we recommend creating one and project maintainers will get back to you as soon as we can.
Read the Code of Conduct and Contact the Maintainers before making any changes or a PR. If an issue doesn’t already exist that describes the change you want to make, we recommend creating one. If an issue does exist, please comment on it saying that you are starting to work on it, to avoid duplicating effort.
This project is governed by the Contributor Covenant v 1.4.1 Any questions can be directed to opensource@indeed.com
Authorization Client is licensed under the Apache 2 license.