0

Scenario : User should not be logged out once tokens expired .

Apple sign up steps :

  1. Successfully validated the authorization code and got a successful response { "access_token" : "",,"refresh_token" : "",expires_in: ""}

  2. Successfully validated the refresh_token obtained from above step and generated a new access token using POST call to https://appleid.apple.com/auth/token

Problem: How generate user data,id_token from the new access token ?

ckaur
  • 1
  • 1

2 Answers2

0

There is no UserInfo API in Apple's ecosystem now. Their access tokens are useless at all.

The only way to get user's display name is receiving "user" json object at callback url at the first time authorization. For email, you can get it in id_token too.

nov matake
  • 938
  • 5
  • 6
  • First Time Authorization seems to be working fine. When we validate refresh_token , we only recieve {access_token: "","token_type:"bearer","expires_in":3600} There is no id_token Or refresh_token returned back. :( – ckaur Jun 03 '20 at 10:01
  • @ckaur Try this to get id_token or refresh_token : https://appleid.apple.com/auth/token – Dharmendra May 02 '23 at 07:44
0
  1. Generate Refresh token

Url : https://appleid.apple.com/auth/token

Request :

{
client_id : your client_ID
client_secret : JWT_token
code : Authentication code (provided when login with Apple, which is expired within 5 minutes)
grant_type : authorization_code
redirect_uri : provided in “Return URL” when creating “Services ID” in Apple account
}
  1. Validate Refresh token & get Access token

Url : https://appleid.apple.com/auth/token

Request :

{
client_id : your client_ID
client_secret : JWT_token
grant_type : refresh_token
refresh_token : refresh_token received in step - 1 API response
}

Refresh token is lifetime validity token, but invalidated when user change password/any other action by user which make session change. So, in that case you need to do re-login to fetch new refresh token.

Dharmendra
  • 189
  • 3
  • 11