codenitive / laravel-oneauth

OAuth and OAuth2 Auth bundle for Laravel
http://bundles.laravel.com/bundle/oneauth
MIT License
86 stars 16 forks source link

access and refresh token string length over 255 #13

Closed fideloper closed 12 years ago

fideloper commented 12 years ago

Hello

I've implemented this library for Basecamp's API. I've successfully been able to use this library as your code supports overriding some key functions to pass parameters, create headers, etc, as Basecamp requires (Thanks! Proper OOP!)

However, one issues I've discovered is that the Basecamp request and refresh tokens have some checksum code, which brings the token past the 255 character limit set by the use of VARCHAR in the database. MySQL silently truncates it to 255 characters.

I've also had to take off the index on the access_token column because of that change to TEXT.

Do you see this as an issue or bug?

Thanks

oneauth/migrations/__migration__.php

<?php

class OneAuth_Create_Clients {
    /**
     * Make changes to the database.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('oneauth_clients', function ($table)
        {
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->string('provider', 50);
            $table->string('uid', 255);
            $table->text('access_token')->nullable(); # Changed to TEXT
            $table->string('secret', 255)->nullable();
            $table->text('refresh_token')->nullable(); # Changed to TEXT
            $table->integer('expires')->defaults(0)->nullable();

            $table->timestamps();
            //$table->index('access_token'); #can't/shouldn't index with type TEXT
            $table->index('user_id');
            $table->unique(array('provider', 'uid'));
        });
    }

    /**
     * Revert the changes to the database.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('oneauth_clients');
    }
}