Yahoo! EOLs OpenID 2, migrates to OpenID Connect


After authenticating, Yahoo! will redirect the user back to your site. The redirection URL will contain a parameter “code” which you can then use to exchange for a JWT with Yahoo!

def oauth_process
  code   = params[:code]
  state  = session[:state]
  client = get_yahoo_client
  
  redirect_url = client.auth_code.authorize_url(
                   redirect_uri: 'https://booko.com.au/oauth_process',
                   scope: scope, 
                   nonce: session[:state])
  
  token = client.auth_code.get_token(code, redirect_uri: redirect_uri(protocol: protocol))
  
  res = JWT.decode(token['id_token'], nil, false)

  if res[0].present?
    openid  = res[0]['openid']
    email   = res[0]['email']
  end
  
end

And now you have a skeleton to build on. Long may you authenticate.

Pages: 1 2


Leave a Reply