Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateUrl() in BaseAuth0 is creating bad URLs #1

Closed
scottbergeron opened this issue Apr 2, 2014 · 2 comments
Closed

generateUrl() in BaseAuth0 is creating bad URLs #1

scottbergeron opened this issue Apr 2, 2014 · 2 comments

Comments

@scottbergeron
Copy link

When I make the following call for creating a User URL

$url = $this->generateUrl('api', '/users');

it returns https://company.auth0.com/apiusers

The problem seems to be the '/' removing part of this function

final protected function generateUrl($domain_key, $path = '/') 
{
    $base_domain = self::$URL_MAP[$domain_key];
    $base_domain = str_replace('{domain}', $this->domain, $base_domain);

    if ($path[0] === '/') {
        $path = substr($path, 1);
    }

    return $base_domain.$path;
}

There's two easy ways to fix this issue:

  1. Remove the if ($path[0] ==='/') {...etc lines from the function OR
  2. In $URL_MAP add a '/' character to the end of each url. So turn

public static $URL_MAP = array( 'api' => 'https://{domain}/api', 'authorize' => 'https://{domain}/authorize', 'token' => 'https://{domain}/oauth/token', 'user_info' => 'https://{domain}/userinfo', );

into

public static $URL_MAP = array( 'api' => 'https://{domain}/api/', 'authorize' => 'https://{domain}/authorize/', 'token' => 'https://{domain}/oauth/token/', 'user_info' => 'https://{domain}/userinfo/', );

@siacomuzzi
Copy link
Member

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants